﻿using DevExpress.XtraEditors.Controls;
using RecruitStudents.Client.BLL;
using RecruitStudents.Utility;
using RecruitStudents.Utility.Const;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace RecruitStudents.Client.Consult
{
    public partial class ConsultForm_Query_List : BaseForm
    {
        ServiceConsult service = new ServiceConsult();
        public ConsultForm_Query_List()
        {
            InitializeComponent();
            BindConsultResorce();
        }

        #region 绑定来源
        private void BindConsultResorce()
        {
            this.ConsultResorce.Properties.NullText = "";
            //this.ConsultResorce.Properties.Columns.Add(new LookUpColumnInfo("Key", 30, "来源方式代码"));
            this.ConsultResorce.Properties.Columns.Add(new LookUpColumnInfo("Value", 55, "来源方式名称"));
            this.ConsultResorce.Properties.DataSource = ConstAppConfig.DicConsultResorceType.ToList();
            this.ConsultResorce.Properties.DisplayMember = "Value";
            this.ConsultResorce.Properties.ValueMember = "Key";
        }
        #endregion

        private void btnQuery_Click(object sender, EventArgs e)
        {
            DataTable dt = service.GetRepliedProblemTable("", ckIsTop.Checked.ToSafeString().ToLower(), ckIsPayFee.Checked.ToSafeString().ToLower(), ckIsStudent.Checked.ToSafeString().ToLower(), ConsultResorce.EditValue.ToSafeString(), txtMsgTitle.Text, txtMsgUsersNickName.Text);
            if (dt != null)
            {
                dt.Columns.Add("strNO", typeof(int));
                for (int i = 1; i <= dt.Rows.Count; i++)
                {
                    dt.Rows[i - 1]["strNO"] = i;
                }
            }
            dgvDisplayMsg.DataSource = dt;
        }
    }
}
